import request from '@/utils/request';

const api = {
	LIST: '/uc/order_list',
	PREVIEW: '/uc/order_preview',
	GENERATE: '/uc/order_generate',
	DETAIL: '/uc/order_detail'
}

export async function orderList(filter) {
	let params = {
		filter: filter
	}
	return request.get(api.LIST, params);
}

export async function orderPreview(consumes, couponId, addressId) {
	let params = {
		consumes: consumes,
		couponId: couponId,
		addressId: addressId
	}
	return request.post(api.PREVIEW, params);
}

export async function orderGenerate(consumes, couponId, addressId, message) {
	let params = {
		consumes: consumes,
		couponId: couponId,
		addressId: addressId,
		message: message
	}
	return request.post(api.GENERATE, params);
}

export async function orderDetail(id) {
	let params = {
		id: id
	}
	return request.get(api.DETAIL, params);
}

